/*
 * udp.cc
 *
 *  Created on: Dec 16, 2014
 *      Author: root
 */
#include <arpa/inet.h>
#include <stdio.h>
#include "udp.h"

unsigned char* Udp::GetUdpPayload() {
	return (unsigned char*) this + sizeof(struct udphdr);
}
unsigned int Udp::GetUdpPayloadLen() {
	return (ntohs)(this->len) - UDP_HEADER_LEN;
}
void Udp::ToString() {
	char info[1024] = { 0 };
	sprintf(info, "UDP %d, %d, %d:%d", ntohs(this->len), GetUdpPayloadLen(),
			ntohs(this->source), ntohs(this->dest));
	printf("%s\n", info);
}
